﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace System.Collections.Observable.ExtendedEventArgs
{
    static public class PropertyChangedEventArgsExtensions
    {
        static public Object GetSourceItem(this PropertyChangedEventArgs eventArgs)
        {
            ExtendedPropertyChangedEventArgs exArgs = eventArgs as ExtendedPropertyChangedEventArgs;
            if (exArgs == null)
            {
                return null;
            }

            return exArgs.SourceItem;
        }

        static public Object GetSourceCollection(this PropertyChangedEventArgs eventArgs)
        {
            ExtendedPropertyChangedEventArgs exArgs = eventArgs as ExtendedPropertyChangedEventArgs;
            if (exArgs == null)
            {
                return null;
            }

            return exArgs.SourceCollection;
        }
    }
}
